#
# Grand Unified Makefile for Xen.
#

#KERNELS ?= linux-2.6-xen
# You may use wildcards in the above e.g. KERNELS=*2.6*

#XKERNELS := $(foreach kernel, $(KERNELS), $(patsubst buildconfigs/mk.%,%,$(wildcard buildconfigs/mk.$(kernel))) )

# Export target architecture overrides to Xen and Linux sub-trees.
ifeq ($(XEN_TARGET_ARCH),arm)
ifndef XEN_TARGET_SUBARCH
$(error "Unknown platform")
endif
SUBARCH := $(subst arch-,,$(XEN_TARGET_SUBARCH))
endif

ifneq ($(XEN_TARGET_ARCH),)
SUBARCH := $(subst x86_32,i386,$(XEN_TARGET_ARCH))
export XEN_TARGET_ARCH SUBARCH XEN_SYSTYPE
endif

# Default target must appear before any include lines
all: dist

XEN_ROOT=$(CURDIR)
export XEN_ROOT
include Config.mk

ifeq ($(XEN_TARGET_X86_PAE),y)
export pae=y
endif

.PHONY:	all dist install xen kernels world clean
.PHONY:	mkpatches mrproper kbuild kdelete kclean

# build and install everything into the standard system directories
install: install-xen install-kernels

# The test target is for unit tests that can run without an installation.  Of
# course, many tests require a machine running Xen itself, and these are
# handled elsewhere.

# build and install everything into local dist directory
dist: DESTDIR=$(DISTDIR)/install
dist: dist-xen
dist-%: DESTDIR=$(DISTDIR)/install
dist-%: install-%
	@: # do nothing

# Legacy dist targets
xen: dist-xen

install-xen:
	$(MAKE) -C xen

# clean doesn't do a kclean
clean:: 
	$(MAKE) -C xen clean

menuconfig:
	$(MAKE) -C xen menuconfig

